﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LiveCPEWinForm.LiveCPEWS;

namespace LiveCPEWinForm.Gestionnaire
{
	public class GestMessage
	{
        private MessageWS lMessage;

        public MessageWS Message
        {
            get { return lMessage; }
            set { lMessage = value; }
        }

        private List<CommentWS> lstComment;

        public List<CommentWS> Comments
        {
            get { return lstComment; }
            set { lstComment = value; }
        }
        
        
        public GestMessage(GestAPP pGestAPP, MessageWS pMsg)
        {
            lMessage = pMsg;
            lstComment = new List<CommentWS>();
            try
            {
                // Utilisation d'un requete synchrone
                foreach (CommentWS cmt in pGestAPP.Service.GetComments(lMessage.MessageID.ToString()))
                {
                    lstComment.Add(cmt);
                }
            }
            catch (Exception)
            {

            }
        }
	}
}
